<?php
class projects {
    public function getProjectList()
	{
            $SQL = "SELECT idproject, name, developers, client, version, version_date, download_link FROM project ORDER BY version_date DESC";
            $query = mysql_query($SQL);
            $nummer = 0;
            $return = array();
            
            while($result = mysql_fetch_row($query)){
                $return[$nummer] = $result;
                $nummer++;
            }
            return $return;
	}
        
        public function getProject($id){
            $SQL = "SELECT name, ";
            if($_SESSION['language'] == 'en'){
                $SQL .= "descriptionEN, ";
            }
            else{
                $SQL .="descriptionNL, ";
            }
            $SQL .= "developers, client, version, download_link FROM project WHERE idproject = ". $id . " LIMIT 1";
            $query = mysql_query($SQL);
            return mysql_fetch_array($query);
        }
        
        public function getProjectImages($id){
            $SQL = "SELECT source_image,";
            
            if($_SESSION['language'] == 'en'){
                $SQL .= "titleEN, ";
            }
            else{
                $SQL .="titleNL, ";
            }
            $SQL .= "width, height FROM project_images WHERE project_idproject = " . $id;
            
            $query = mysql_query($SQL);
            $return = array();
            $nummer = 0;
            
            while($result = mysql_fetch_row($query)){
                $return[$nummer] = $result;
                $nummer++;
            }
            
            return $return;
        }
}

?>
